package cn.itcast.day05.demo02;

public class Demo05StringSplit {
    public static void main(String[] args) {
        String str1 = "aaa,bbb,ccc";
        String[] array1 = str1.split(",");
        for (int i = 0; i < array1.length; i++) {
            System.out.println(array1[i]);
        }
        System.out.println("===========");
        String str2 = "aaa bbb ccc";
        String str3 = str2.replace(" ", "*");
        System.out.println(str3);
        String[] array2 = str3.split("\\*");//测出的*号需要通过转义字符
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }
}